package com.tjetc.config;

import com.tjetc.interceptor.LoginInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//配置自定义登录拦截器
//@Configuration
public class LoginInterceptorConfig implements WebMvcConfigurer {
    //@Autowired
    private LoginInterceptor loginInterceptor;

    //添加自定义的拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor).
                //loginInterceptor拦截器对所有url进行拦截
                        addPathPatterns("/**").
                //排除掉哪些url，也就是不拦截
                        excludePathPatterns("/user/login", "/user/all","/image/**", "/test/**", "/error");
    }
}
